package com.recsmile.sgs.client.commonds;

import com.recsmile.sgs.client.entity.Hero;
import com.recsmile.sgs.client.entity.PlayerInfo;
import com.recsmile.sgs.client.operations.DealOperation;
import com.recsmile.sgs.client.ui.components.ClientGameUI;
import com.recsmile.sgs.client.ui.components.GamePanel;

public class DealStartGameUIClientCommmand extends GeneralGameUIClientCommand {

	private static final long serialVersionUID = 5784317669561501939L;

	private final PlayerInfo currentPlayer;
	
	public DealStartGameUIClientCommmand(PlayerInfo currentPlayer) {
		this.currentPlayer = currentPlayer;
	}
	@Override
	public void execute(GamePanel<? extends Hero> panel) {
		ClientGameUI<? extends Hero> panelUI = panel.getContent();
		if (panelUI.getSelf().getPlayerInfo().equals(currentPlayer)) {
			panel.pushOperation(new DealOperation(), null);
		} else {
			panelUI.getOtherPlayerUI(currentPlayer).showCountdownBar();
		}
	}

}
